package com.zzg.test2.activity

import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.GridLayoutManager
import com.zzg.test2.adapter.HomeTabAdapter
import com.zzg.test2.databinding.ActivityTabHomeBinding
import com.zzg.test2.listener.ItemClickListener

/**
 *
 * @ClassName: LeadMainActivity
 * @Description:
 * @Author: zhouzhiguo
 * @Date: 2025/8/27 17:06
 * @Version: 5.3.8
 */

class LeadMainActivity:AppCompatActivity () {
   private lateinit var binding:ActivityTabHomeBinding

    /**
     * 当前选中的tab
     */
    private var currentIndex = 0
    override fun onCreate(savedInstanceState: android.os.Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityTabHomeBinding.inflate(layoutInflater)
        setContentView(binding.root)
    }

    fun initView() {
        binding.tabRecycleView.layoutManager = GridLayoutManager(this, 5)
        val adapter = HomeTabAdapter(this)
        binding.tabRecycleView.adapter =adapter
        adapter.itemClickListener = object : ItemClickListener {
            override fun onRecyclerItemClick(adapterPosition: Int, view: View) {
                if (adapterPosition >= 0 && adapterPosition < 4) {
                    currentIndex = adapterPosition
                }

            }
        }
    }
}